<div class="modal" ng-controller="BpmnEditorDueDatePopupCtrl">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button aria-hidden="true" class="close" data-dismiss="modal" ng-click="close()" type="button">&times;</button>
        <h2 translate>PROPERTY.DUEDATE.TITLE</h2>
      </div>
      <div class="modal-body">

        <div class="clearfix first">
          <div class="col-xs-12">
            <div class="col-xs-12">
              <div class="btn-group span">
                <button activiti-fix-dropdown-bug bs-select
                        class="selection"
                        data-toggle="dropdown" ng-change="dueDateOptionChanged()" ng-model="popup.selectedDueDateOption"
                        ng-options="option.id as (option.title | translate) for option in taskDueDateOptions">
                  <i class="icon icon-caret-down"></i>
                </button>
              </div>
            </div>
          </div>
        </div>

        <div class="clearfix first" ng-if="popup.selectedDueDateOption === 'expression'" style="padding-top: 10px">
          <div class="col-xs-12">
            <div class="col-xs-4">
              <label>{{'PROPERTY.DUEDATE.EXPRESSION-LABEL' | translate}}: </label>
            </div>
            <div class="col-xs-8">
              <input class="form-control" id="expression" ng-model="popup.duedateExpression" type="text">
            </div>
          </div>
        </div>

        <div class="clearfix first" ng-if="popup.selectedDueDateOption === 'field'" style="padding-top: 10px">
          <div class="col-xs-12">
            <div class="col-xs-4">
              <label>{{'PROCESS-BUILDER.FIELD.TIMER.DATE-FIELD' | translate}}: </label>
            </div>
            <div class="col-xs-8">
              <div all-steps="allSteps" editor-type="bpmn" field-select="popup.duedate.field.taskDueDateField"
                   field-type-filter="['date']" step-id="selectedShape.resourceId"></div>
            </div>
          </div>
        </div>

        <div class="clearfix first" ng-if="popup.selectedDueDateOption === 'field'" style="padding-top: 10px">
          <div class="col-xs-12">
            <div class="col-xs-4">
              <label>{{'PROCESS-BUILDER.FIELD.DUEDATE.CALCULATION-TYPE' | translate}}: </label>
            </div>
            <div class="col-xs-8">
              <div class="btn-group btn-group-justified">
                <div class="btn-group">
                  <button class="btn btn-default"
                          ng-class="{'active' : (!popup.duedate.field.taskDueDateCalculationType || popup.duedate.field.taskDueDateCalculationType == 'add')}"
                          ng-click="setAddCalculationType()"
                          ng-model="popup.duedate.field.taskDueDateCalculationType"
                          type="button">
                    {{'PROCESS-BUILDER.FIELD.DUEDATE.CALCULATION-OPTIONS.ADD' | translate}}
                  </button>
                </div>
                <div class="btn-group">
                  <button class="btn btn-default"
                          ng-class="{'active' : popup.duedate.field.taskDueDateCalculationType == 'subtract'}"
                          ng-click="setSubtractCalculationType()"
                          ng-model="popup.duedate.field.taskDueDateCalculationType"
                          type="button">
                    {{'PROCESS-BUILDER.FIELD.DUEDATE.CALCULATION-OPTIONS.SUBTRACT' | translate}}
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>

        <div class="clearfix first" ng-if="popup.selectedDueDateOption === 'field'" style="padding-top: 10px">
          <div class="col-xs-12">
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.YEARS' | translate}}:<input class="form-control"
                                                                         ng-model="popup.duedate.field.years"
                                                                         type="number">
            </div>
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.MONTHS' | translate}}:<input class="form-control"
                                                                          ng-model="popup.duedate.field.months"
                                                                          type="number">
            </div>
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.DAYS' | translate}}:<input class="form-control"
                                                                        ng-model="popup.duedate.field.days"
                                                                        type="number">
            </div>
          </div>
          <div class="col-xs-12">
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.HOURS' | translate}}:<input class="form-control"
                                                                         ng-model="popup.duedate.field.hours"
                                                                         type="number">
            </div>
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.MINUTES' | translate}}:<input class="form-control"
                                                                           ng-model="popup.duedate.field.minutes"
                                                                           type="number">
            </div>
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.SECONDS' | translate}}:<input class="form-control"
                                                                           ng-model="popup.duedate.field.seconds"
                                                                           type="number">
            </div>
          </div>
        </div>

        <div class="clearfix first" ng-if="popup.selectedDueDateOption === 'static'" style="padding-top: 10px">
          <div class="col-xs-12">
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.YEARS' | translate}}:<input class="form-control"
                                                                         ng-model="popup.duedate.fixed.years"
                                                                         type="number">
            </div>
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.MONTHS' | translate}}:<input class="form-control"
                                                                          ng-model="popup.duedate.fixed.months"
                                                                          type="number">
            </div>
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.DAYS' | translate}}:<input class="form-control"
                                                                        ng-model="popup.duedate.fixed.days"
                                                                        type="number">
            </div>
          </div>
          <div class="col-xs-12">
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.HOURS' | translate}}:<input class="form-control"
                                                                         ng-model="popup.duedate.fixed.hours"
                                                                         type="number">
            </div>
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.MINUTES' | translate}}:<input class="form-control"
                                                                           ng-model="popup.duedate.fixed.minutes"
                                                                           type="number">
            </div>
            <div class="col-xs-4">
              {{'PROCESS-BUILDER.FIELD.TIMER.SECONDS' | translate}}:<input class="form-control"
                                                                           ng-model="popup.duedate.fixed.seconds"
                                                                           type="number">
            </div>
          </div>
        </div>

        <div class="modal-footer">
          <button class="btn btn-primary" ng-click="close()" translate>ACTION.CANCEL</button>
          <button class="btn btn-primary" ng-click="save()" translate>ACTION.SAVE</button>
        </div>
      </div>
    </div>
  </div>
